package com.zy.xuanwo.acitivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.PersistableBundle;
import android.support.v7.app.AppCompatActivity;

import com.zy.xuanwo.R;
import com.zy.xuanwo.utils.SharedPreferencesUtils;

/**
 * @功能 欢迎启动页
 * Created by njb on 2016/7/2.
 */
public class SplashActivity extends AppCompatActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        //延迟2000ms跳转到主页面
        new Handler().postDelayed(new Runnable() {

            @Override
            public void run() {
                if(SharedPreferencesUtils.contains(SplashActivity.this, getResources().getString(R.string.login_flag))){
                    Intent intent = new Intent(SplashActivity.this,MainActivity.class);
                    startActivity(intent);
                    finish();
                }else {
                    Intent intent = new Intent(SplashActivity.this,LoginActivity.class);
                    startActivity(intent);
                    finish();
                }
            }
        }, 2000);

    }


}
